import Plotly from "plotly.js/lib/core";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
import bar from "plotly.js/lib/bar";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
import pie from "plotly.js/lib/pie";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
import histogram from "plotly.js/lib/histogram";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
import box from "plotly.js/lib/box";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
import heatmap from "plotly.js/lib/heatmap";

import prepareData from "./prepareData";
import prepareLayout from "./prepareLayout";
import updateData from "./updateData";
import updateAxes from "./updateAxes";
import updateChartSize from "./updateChartSize";
import { prepareCustomChartData, createCustomChartRenderer } from "./customChartUtils";

var locale = {
  moduleType: "locale",
  name: "zh-CN",
  dictionary: {
    Autoscale: "\u81ea\u52a8\u7f29\u653e",
    "Box Select":"\u77e9\u5f62\u6846\u9009",
    "Click to enter Colorscale title": "\u70b9\u51fb\u8f93\u5165\u8272\u9636\u7684\u6807\u9898", 
    "Click to enter Component A title": "\u70b9\u51fb\u8f93\u5165\u7ec4\u4ef6A\u7684\u6807\u9898", 
    "Click to enter Component B title": "\u70b9\u51fb\u8f93\u5165\u7ec4\u4ef6B\u7684\u6807\u9898", 
    "Click to enter Component C title": "\u70b9\u51fb\u8f93\u5165\u7ec4\u4ef6C\u7684\u6807\u9898", 
    "Click to enter Plot title": "\u70b9\u51fb\u8f93\u5165\u56fe\u8868\u7684\u6807\u9898", 
    "Click to enter X axis title": "\u70b9\u51fb\u8f93\u5165X\u8f74\u7684\u6807\u9898", 
    "Click to enter Y axis title": "\u70b9\u51fb\u8f93\u5165Y\u8f74\u7684\u6807\u9898", 
    "Compare data on hover": "\u60ac\u505c\u65f6\u6bd4\u8f83\u6570\u636e", 
    "Double-click on legend to isolate one trace": "\u53cc\u51fb\u56fe\u4f8b\u6765\u7a81\u663e\u5bf9\u5e94\u8f68\u8ff9", 
    "Double-click to zoom back out": "\u53cc\u51fb\u8fd4\u56de\u7f29\u5c0f\u663e\u793a", 
    "Download plot as a png": "\u4e0b\u8f7d\u56fe\u8868\u4e3aPNG\u683c\u5f0f", 
    "Download plot": "\u4e0b\u8f7d\u56fe\u8868", 
    "Edit in Chart Studio": "\u5728Chart Studio\u4e2d\u7f16\u8f91", 
    "IE only supports svg.  Changing format to svg.": 
    "IE\u53ea\u652f\u6301SVG\u3002\u8f6c\u6362\u683c\u5f0f\u4e3aSVG\u3002", 
    "Lasso Select": "\u5957\u7d22\u9009\u62e9", 
    "Orbital rotation": "\u8f68\u9053\u65cb\u8f6c", 
    Pan: "\u5e73\u79fb", 
    "Produced with Plotly": 
    "\u7531Plotly\u751f\u6210", 
    Reset: "\u91cd\u7f6e", 
    "Reset axes": "\u91cd\u7f6e\u8f74", 
    "Reset camera to default": "\u91cd\u7f6e\u955c\u5934\u89c6\u89d2\u4e3a\u9ed8\u8ba4\u72b6\u6001", 
    "Reset camera to last save": "\u91cd\u7f6e\u955c\u5934\u89c6\u89d2\u4e3a\u4e0a\u6b21\u4fdd\u5b58\u72b6\u6001", 
    "Reset view": "\u91cd\u7f6e\u89c6\u56fe", 
    "Reset views": "\u91cd\u7f6e\u89c6\u56fe", 
    "Show closest data on hover": "\u60ac\u505c\u65f6\u663e\u793a\u6700\u8fd1\u7684\u6570\u636e", 
    "Snapshot succeeded": "\u751f\u6210\u5feb\u7167\u6210\u529f", 
    "Sorry, there was a problem downloading your snapshot!": "\u62b1\u6b49\uff0c\u4e0b\u8f7d\u5feb\u7167\u51fa\u73b0\u95ee\u9898\uff01", 
    "Taking snapshot - this may take a few seconds": "\u6b63\u5728\u751f\u6210\u5feb\u7167 - \u53ef\u80fd\u9700\u8981\u51e0\u79d2\u949f", 
    Zoom: "\u7f29\u653e", "Zoom in": "\u653e\u5927", "Zoom out": "\u7f29\u5c0f", 
    "close:": "\u5173\u95ed:", 
    trace: "\u8e2a\u8ff9:", 
    "lat:": "\u7eac\u5ea6:", 
    "lon:": "\u7ecf\u5ea6:", 
    "q1:": "\u7b2c\u4e00\u56db\u5206\u4f4d\u6570:", 
    "q3:": "\u7b2c\u4e09\u56db\u5206\u4f4d\u6570:", 
    "source:": "\u6e90:", 
    "target:": "\u76ee\u6807:", 
    "lower fence:": "\u5185\u4fa7\u680f(lower fence):", 
    "upper fence:": "\u5916\u4fa7\u680f(upper fence):", 
    "max:": "\u6700\u5927\u503c:", 
    "mean \xb1 \u03c3:": "\u5e73\u5747\u6570 \xb1 \u6807\u51c6\u5dee\u03c3:", 
    "mean:": "\u5e73\u5747\u6570:", 
    "median:": "\u4e2d\u4f4d\u6570:", 
    "min:": "\u6700\u5c0f\u503c:", 
    "Turntable rotation": "\u65cb\u8f6c\u8f6c\u76d8:", 
    "Toggle Spike Lines": "\u5207\u6362\u663e\u793a\u6570\u636e\u70b9\u8f85\u52a9\u7ebf(Spike Lines)", 
    "open:": "\u6253\u5f00:", 
    "high:": "\u9ad8:", 
    "low:": "\u4f4e:", 
    "Toggle show closest data on hover": "\u5207\u6362\u60ac\u505c\u65f6\u663e\u793a\u6700\u8fd1\u7684\u6570\u636e\u70b9", 
    "incoming flow count:": "\u6d41\u5165\u6570\u91cf:", 
    "outgoing flow count:": "\u6d41\u51fa\u6570\u91cf:", 
    "kde:": "kde:", 
    "Click to enter radial axis title": "\u70b9\u51fb\u8f93\u5165\u5f84\u5411\u8f74\u6807\u9898", 
    "new text": "\u65b0\u5efa\u6587\u672c"
  }, 
  format: {
    days: ["\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d"], 
    shortDays: ["\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d"], 
    months: ["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], 
    shortMonths: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
    date: "%Y-%m-%d"
  }
};

// @ts-expect-error ts-migrate(2339) FIXME: Property 'register' does not exist on type 'typeof... Remove this comment to see the full error message
Plotly.register([bar, pie, histogram, box, heatmap, locale]);
// @ts-expect-error ts-migrate(2339) FIXME: Property 'setPlotConfig' does not exist on type 't... Remove this comment to see the full error message
Plotly.setPlotConfig({
  modeBarButtonsToRemove: ["sendDataToCloud"],
  locale: 'zh-CN'
});

export {
  Plotly,
  prepareData,
  prepareLayout,
  updateData,
  updateAxes,
  updateChartSize,
  prepareCustomChartData,
  createCustomChartRenderer,
};
